﻿var guoneiRadio = function(val) {
	if(val == 1) {
		$("guonei_to_font").style.visibility="hidden";
		$("guonei_return_font").style.visibility="hidden";
		$("date2").disabled=true;
		$("date2").style.display="none";
		return;
	}
	else{
		$("guonei_to_font").style.visibility="visible";
		$("guonei_return_font").style.visibility="visible";
		$("date2").disabled=false;
		$("date2").style.display="";
		return;
	}
}
var guoneiRadio2 = function(val) {
	$("date2").disabled=(val==1)?true:false;
}
//国内form提交
var guoneiSubmit = function() {
	var back_radio = getCheckedValue("FlightType");//1:单程 2:往返
	var from = $("from").value;
	var to = $("to").value;
	var date = $("date").value;
	var date2 = $("date2").value;

	//leungma 2010-10-26 读取城市框输入内容，匹配为三字码
	var tmpfrom=CityUtil.getCityCodeByName($("fc").value);
	if(""==tmpfrom){
		alertError("输入的出发城市有误");
		return;
	}
	var tmpto=CityUtil.getCityCodeByName($("tc").value);
	if(""==tmpto){
		alertError("输入的目的城市有误");
		return;
	}

	from=tmpfrom;
	to=tmpto;
	$("from").value=tmpfrom;
	$("to").value=tmpto;
	
	from = (from == "PVG") ? "SHA" : from;
	to = (to == "PVG") ? "SHA" : to;
	
	var obj = {'back_radio':back_radio, 'from':from, 'to':to, 'date':date, 'date2':date2};
	try {
		checkQueryResult(obj);
	} catch (e) {
		alertError(e);
		return;
	}
	var url = "/flight/ShowFareFirst_"+from+"_"+to+"_"+date+"_1_"+date+".htm";
	if($("FlightType2").checked){
	    url = "/flight/ShowFareFirst_"+from+"_"+to+"_"+date+"_2_"+date2+".htm";
	}
	//window.location.href=url;
	
	document.getElementById("guoneiForm").submit();
	
}
